home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Shareware / Programare / gpssdk / GPS.NET Global Positioning SDK 1.4.6.msi / Data1.cab / MainForm.vb5 < prev    next >
Encoding:
Text File  |  2004-08-25  |  40.5 KB  |  791 lines

  1. ∩╗┐' **************************************************************************
  2. ' ****
  3. ' ****   GpsReceiver.NET Global Positioning SDK Example 1
  4. ' ****   A demonstration of GpsReceiver.NET's major features.
  5. ' ****
  6. ' ****   For assistance with your GPS device or for troubleshooting:
  7. ' ****
  8. ' ****          http://www.gpsdotnet.com/support
  9. ' ****          support@gpsdotnet.com
  10. ' ****
  11. ' ****   To view known product issues & updates in the Knowledge Base:
  12. ' ****
  13. ' ****          http://www.gpsdotnet.com/kb
  14. ' ****
  15. ' ****   For pricing information & online ordering:
  16. ' ****
  17. ' ****          http://www.gpsdotnet.com/purchase
  18. ' ****
  19. ' ****   This source code is considered public domain and may be re-used
  20. ' ****   in your own applications.
  21. ' ****
  22. ' *************************************************************************
  23. ' ****
  24. ' ****   NOTE: Since GpsReceiver.NET is multi-threaded, the Invoke() method is
  25. ' ****   used frequently to make sure that updates to form controls occur
  26. ' ****   on the form's thread.  This prevents the application from locking.
  27. ' ****   up, especially for Compact Framework apps.  For more information, 
  28. ' ****   refer to the Knowledge Base.  
  29. ' ****
  30. ' *************************************************************************
  31.  
  32. Imports StormSource.Gps
  33.  
  34. Public Class MainForm
  35.  
  36. #Region " Starting the GPS Service "
  37.  
  38.     Private Sub StartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartButton.Click
  39.         ' Set the COM port to the numeric portion of the selected item in to combo box
  40.         GpsReceiver.Device.Settings.ComPort = ComPortComboBox.Value
  41.         GpsReceiver.Device.Settings.BaudRate = BaudRateComboBox.Value
  42.         ' NOTE: It's important to add error checking around the Start() method and Enabled property
  43.         Try
  44.             ' Set the license key (which will suppress the trial "nag" screen)
  45.             ' GpsReceiver.SetLicenseKey("[insert your license here]")
  46.             ' Start receiving messages
  47.             GpsReceiver.Start()
  48.         Catch ex As UnauthorizedAccessException
  49.             ' The trial screen was cancelled 
  50.             MessageBox.Show(ex.ToString, "Cannot Continue Trial", MessageBoxButtons.OK, MessageBoxIcon.Error)
  51.         Catch ex As GpsException
  52.             ' Notify of the error
  53.             MessageBox.Show(ex.ToString, "Unable to Begin GPS Communications", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  54.         End Try
  55.     End Sub
  56.  
  57.     ' Raised just before a connection attempt is made
  58.     Private Sub GPS_Connecting(ByVal sender As Object, ByVal e As DeviceSettingsEventArgs) Handles GpsReceiver.Connecting
  59.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Connecting to GPS device...")
  60.     End Sub
  61.  
  62.     Private Sub GPS_Connected(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.Connected
  63.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Connected to GPS device, please wait...")
  64.         ' Enable the Stop button, disable the Start button
  65.         Me.Invoke(New EventHandler(AddressOf EnableStopButton))
  66.     End Sub
  67.  
  68.     ' Invoked from the GpsReceiver.NET thread to enable the stop button
  69.     Private Sub EnableStopButton(ByVal sender As Object, ByVal e As System.EventArgs)
  70.         StopButton.Enabled = True
  71.         StartButton.Enabled = False
  72.         BaudRateComboBox.Enabled = False
  73.         ComPortComboBox.Enabled = False
  74.     End Sub
  75.  
  76.     Private Sub GPS_Acquiring(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.Acquiring
  77.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Please wait while satellite information is gathered...")
  78.     End Sub
  79.  
  80.     ' Raised when the receiver has adjusted the baud rate in an attempt to receive GPS information
  81.     Private Sub GPS_BaudRateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.BaudRateChanged
  82.         Select Case GpsReceiver.Device.Settings.BaudRate
  83.             Case 4800
  84.                 Me.BaudRateComboBox.SelectedIndex = 0
  85.             Case 9600
  86.                 Me.BaudRateComboBox.SelectedIndex = 1
  87.         End Select
  88.     End Sub
  89.  
  90.     Private Sub GPS_Timeout(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.Timeout
  91.         MessageBox.Show("The GPS device did not respond to commands, even after attempts to detect the correct connection settings.  The device may be powered off.  Try restarting the Receiver.", "GPS Device Timeout", MessageBoxButtons.OK, MessageBoxIcon.Hand)
  92.     End Sub
  93. #End Region
  94.  
  95. #Region " Stopping the GPS Service "
  96.  
  97.     Private Sub StopButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StopButton.Click
  98.         GpsReceiver.Stop()
  99.     End Sub
  100.  
  101.     ' Raised just before an attempt is made to disconnect from the GPS device
  102.     Private Sub GPS_Disconnecting(ByVal sender As Object, ByVal e As DeviceSettingsEventArgs) Handles GpsReceiver.Disconnecting
  103.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Disconnecting from GPS device...")
  104.     End Sub
  105.  
  106.     ' Raised when the connection with the device is now closed
  107.     Private Sub GPS_Disconnected(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.Disconnected
  108.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Disconnected from GPS device.")
  109.         ' Reset start & stop buttons
  110.         Me.Invoke(New EventHandler(AddressOf EnableStartButton))
  111.     End Sub
  112.  
  113.     ' Invoked from the GpsReceiver.NET thread to enable the stop button
  114.     Private Sub EnableStartButton(ByVal sender As Object, ByVal e As System.EventArgs)
  115.         StartButton.Enabled = True
  116.         PowerOffButton.Enabled = False
  117.         DownloadWaypointButton.Enabled = False
  118.         EditWaypointButton.Enabled = False
  119.         NewWaypointButton.Enabled = False
  120.         StopButton.Enabled = False
  121.         BaudRateComboBox.Enabled = True
  122.         ComPortComboBox.Enabled = True
  123.     End Sub
  124.  
  125. #End Region
  126.  
  127. #Region " Demonstration of Motion-Related GPS Events "
  128.  
  129.     ' Updates the current speed
  130.     Private Sub UpdateSpeed(ByVal sender As Object, ByVal e As SpeedEventArgs)
  131.         ' Are we using the Imperial or Metric system?
  132.         If System.Globalization.RegionInfo.CurrentRegion.IsMetric Then
  133.             ' Use the Metric system
  134.             Speed.Text = e.Speed.ToKilometersPerHour.ToString
  135.         Else
  136.             ' Use the Imperial system
  137.             Speed.Text = e.Speed.ToStatuteMilesPerHour.ToString
  138.         End If
  139.     End Sub
  140.  
  141.     ' Updates the current altitude
  142.     Private Sub UpdateAltitude(ByVal sender As Object, ByVal e As DistanceEventArgs)
  143.         ' Are we using the Imperial or Metric system?
  144.         If System.Globalization.RegionInfo.CurrentRegion.IsMetric Then
  145.             ' Use the metric system
  146.             Altitude.Text = e.Distance.ToMeters.ToString
  147.         Else
  148.             ' Use the Imperial system
  149.             Altitude.Text = e.Distance.ToFeet.ToString
  150.         End If
  151.     End Sub
  152.  
  153.     ' Updates the current bearing
  154.     Private Sub UpdateBearing(ByVal sender As Object, ByVal e As AzimuthEventArgs)
  155.         ' Update the bearing
  156.         Bearing.Text = e.Azimuth.ToString
  157.         ' And show the current bearing represented as a cardinal (compass) direction
  158.         Direction.Text = e.Azimuth.CardinalDirection.ToString
  159.     End Sub
  160.  
  161.     ' Updates the currentposition (in UTM)
  162.     Private Sub UpdateUtmPosition(ByVal sender As Object, ByVal e As UtmPositionEventArgs)
  163.         ' Update the current position (in UTM)
  164.         UtmPosition.Text = e.UtmPosition.ToString
  165.     End Sub
  166.  
  167.     ' Updates the current location
  168.     Private Sub UpdatePosition(ByVal sender As Object, ByVal e As PositionEventArgs)
  169.         ' Update the current latitude
  170.         Latitude.Text = e.Position.Latitude.ToString
  171.         ' Update the longitude
  172.         Longitude.Text = e.Position.Longitude.ToString
  173.     End Sub
  174.  
  175.     ' Updates the current magnetic variation
  176.     Private Sub UpdateMagneticVariation(ByVal sender As Object, ByVal e As LongitudeEventArgs)
  177.         MagneticVariation.Text = e.Longitude.ToString
  178.     End Sub
  179.  
  180.     Private Sub GPS_AltitudeChanged(ByVal sender As Object, ByVal e As DistanceEventArgs) Handles GpsReceiver.AltitudeChanged
  181.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Altitude has changed.")
  182.         ' Update the current altitude
  183.         Me.Invoke(New DistanceEventHandler(AddressOf UpdateAltitude), sender, e)
  184.     End Sub
  185.  
  186.     Private Sub GPS_BearingChanged(ByVal sender As Object, ByVal e As AzimuthEventArgs) Handles GpsReceiver.BearingChanged
  187.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Bearing has changed.")
  188.         ' Update the bearing and compass direction
  189.         Me.Invoke(New AzimuthEventHandler(AddressOf UpdateBearing), sender, e)
  190.     End Sub
  191.  
  192.     Private Sub GPS_SpeedChanged(ByVal sender As Object, ByVal e As SpeedEventArgs) Handles GpsReceiver.SpeedChanged
  193.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Speed has changed.")
  194.         ' Update the speed
  195.         Me.Invoke(New SpeedEventHandler(AddressOf UpdateSpeed), sender, e)
  196.     End Sub
  197.  
  198.     Private Sub GPS_PositionChanged(ByVal sender As Object, ByVal e As PositionEventArgs) Handles GpsReceiver.PositionChanged
  199.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Position has changed.")
  200.         ' Update the labels with the new position
  201.         Me.Invoke(New PositionEventHandler(AddressOf UpdatePosition), sender, e)
  202.     End Sub
  203.  
  204.     ' Raised when UTM coordinates have been reported from the GPS device
  205.     Private Sub GPS_UtmPositionChanged(ByVal sender As Object, ByVal e As StormSource.Gps.UtmPositionEventArgs) Handles GpsReceiver.UtmPositionChanged
  206.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "UTM position has changed.")
  207.         ' Update the UTM position
  208.         Me.Invoke(New UtmPositionEventHandler(AddressOf UpdateUtmPosition), sender, e)
  209.     End Sub
  210.  
  211. #End Region
  212.  
  213. #Region " Demonstration of Precision-Related Events "
  214.  
  215.     ' Updates the form with dilution of precision (accuracy) information
  216.     Private Sub UpdateMeanDilutionOfPrecision(ByVal sender As Object, ByVal e As DilutionOfPrecisionEventArgs)
  217.         ' Update the overall (mean) accuracy 
  218.         MeanDilutionOfPrecision.Text = e.DilutionOfPrecision.ToString
  219.     End Sub
  220.  
  221.     ' Updates the form with dilution of precision (accuracy) information
  222.     Private Sub UpdateHorizontalDilutionOfPrecision(ByVal sender As Object, ByVal e As DilutionOfPrecisionEventArgs)
  223.         ' Update the accuract of latitude/longitude measurements
  224.         HorizontalDilutionOfPrecision.Text = e.DilutionOfPrecision.ToString
  225.     End Sub
  226.  
  227.     ' Updates the form with dilution of precision (accuracy) information
  228.     Private Sub UpdateVerticalDilutionOfPrecision(ByVal sender As Object, ByVal e As DilutionOfPrecisionEventArgs)
  229.         ' Update the accuracy of altitude measurements
  230.         VerticalDilutionOfPrecision.Text = e.DilutionOfPrecision.ToString
  231.     End Sub
  232.  
  233.     ' Raised when the accuracy of latitude/longitude measurements has changed
  234.     Private Sub GPS_HorizontalDilutionOfPrecisionChanged(ByVal sender As Object, ByVal e As DilutionOfPrecisionEventArgs) Handles GpsReceiver.HorizontalDilutionOfPrecisionChanged
  235.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Lat/long accuracy has changed to " & e.DilutionOfPrecision.ToString)
  236.         ' Update the accuracy information
  237.         Invoke(New DilutionOfPrecisionEventHandler(AddressOf UpdateHorizontalDilutionOfPrecision), sender, e)
  238.     End Sub
  239.  
  240.     ' Raised when the mean accuracy in the current latitude/longitude has changed
  241.     Private Sub GPS_MeanDilutionOfPrecisionChanged(ByVal sender As Object, ByVal e As DilutionOfPrecisionEventArgs) Handles GpsReceiver.MeanDilutionOfPrecisionChanged
  242.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "General accuracy has changed to " & e.DilutionOfPrecision.ToString)
  243.         ' Update the accuracy information
  244.         Invoke(New DilutionOfPrecisionEventHandler(AddressOf UpdateMeanDilutionOfPrecision), sender, e)
  245.     End Sub
  246.  
  247.     ' Raised when the confidence level of altitude measurements has changed
  248.     Private Sub GPS_VerticalDilutionOfPrecisionChanged(ByVal sender As Object, ByVal e As DilutionOfPrecisionEventArgs) Handles GpsReceiver.VerticalDilutionOfPrecisionChanged
  249.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Altitude accuracy has changed to " & e.DilutionOfPrecision.ToString)
  250.         ' Update the accuracy information
  251.         Invoke(New DilutionOfPrecisionEventHandler(AddressOf UpdateVerticalDilutionOfPrecision), sender, e)
  252.     End Sub
  253.  
  254.     Private Sub GPS_MagneticVariationChanged(ByVal sender As Object, ByVal e As LongitudeEventArgs) Handles GpsReceiver.MagneticVariationChanged
  255.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Magnetic variation has changed")
  256.         ' Update the magnetic variation
  257.         Invoke(New LongitudeEventHandler(AddressOf UpdateMagneticVariation), sender, e)
  258.     End Sub
  259.  
  260.     Private Sub GPS_CrossTrackErrorChanged(ByVal sender As Object, ByVal e As StormSource.Gps.CrossTrackErrorEventArgs) Handles GpsReceiver.CrossTrackErrorChanged
  261.         ' Update the cross-track error
  262.         Me.Invoke(New CrossTrackErrorEventHandler(AddressOf UpdateCrossTrackError), sender, e)
  263.     End Sub
  264.  
  265. #End Region
  266.  
  267. #Region " Demonstration of Exception Handling "
  268.  
  269.     Public Sub UpdateErrors(ByVal sender As Object, ByVal e As ErrorEventArgs)
  270.         ' Add the error to the top of the list
  271.         GpsExceptionTextBox.Text = e.Exception.ToString & vbCrLf & GpsExceptionTextBox.Text
  272.     End Sub
  273.  
  274.     Public Sub UpdateParsingErrors(ByVal sender As Object, ByVal e As ParsingErrorEventArgs)
  275.         ' Add the error to the top of the list
  276.         ParsingExceptionTextBox.Text = e.ParsingException.ToString & vbCrLf & ParsingExceptionTextBox.Text
  277.     End Sub
  278.  
  279.     ' NOTE: This event is raised for errors which occur on separate threads within the GpsReceiver.NET engine. 
  280.     '       Use Try..Catch blocks to handle typical GPS errors via the GPSException class.
  281.     Private Sub GPS_ErrorOccurred(ByVal sender As Object, ByVal e As ErrorEventArgs) Handles GpsReceiver.ErrorOccurred
  282.         Me.Invoke(New ErrorEventHandler(AddressOf UpdateErrors), sender, e)
  283.     End Sub
  284.  
  285.     ' This event is raised when invalid or corrupt data is received by the device.  This event only
  286.     ' serves as a warning that some data was not 100% understood.  These
  287.     ' errors are not typically forwarded to the user.
  288.     Private Sub GPS_ParsingErrorOccurred(ByVal sender As Object, ByVal e As ParsingErrorEventArgs) Handles GpsReceiver.ParsingErrorOccurred
  289.         Me.Invoke(New ParsingErrorEventHandler(AddressOf UpdateParsingErrors), sender, e)
  290.     End Sub
  291. #End Region
  292.  
  293. #Region " Demonstration of Fix-Related Events "
  294.  
  295.     Public Sub UpdateFixInformation(ByVal sender As Object, ByVal e As System.EventArgs)
  296.         If GpsReceiver.IsFixObtained Then
  297.             FixObtained.Text = "Fix Obtained"
  298.         Else
  299.             FixObtained.Text = "No Fix Available"
  300.         End If
  301.         FixMethod.Text = GpsReceiver.FixMethod.ToString
  302.         FixMode.Text = GpsReceiver.FixMode.ToString
  303.         FixQuality.Text = GpsReceiver.FixQuality.ToString
  304.         FixLikelihood.Text = GpsReceiver.FixLikelihood.ToString
  305.     End Sub
  306.  
  307.     Private Sub GpsReceiver_FixLikelihoodChanged(ByVal sender As Object, ByVal e As StormSource.Gps.FixLikelihoodEventArgs) Handles GpsReceiver.FixLikelihoodChanged
  308.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Fix likelihood/stability has changed to " & e.FixLikelihood.ToString)
  309.         ' Update the magnetic variation
  310.         Invoke(New EventHandler(AddressOf UpdateFixInformation))
  311.     End Sub
  312.  
  313.     Private Sub GPS_FixLost(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.FixLost
  314.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Satellite fix has been lost.")
  315.         ' Update the magnetic variation
  316.         Invoke(New EventHandler(AddressOf UpdateFixInformation))
  317.     End Sub
  318.  
  319.     Private Sub GPS_FixMethodChanged(ByVal sender As Object, ByVal e As FixMethodEventArgs) Handles GpsReceiver.FixMethodChanged
  320.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Satellite fix method has changed.")
  321.         ' Update the magnetic variation
  322.         Invoke(New EventHandler(AddressOf UpdateFixInformation))
  323.     End Sub
  324.  
  325.     Private Sub GPS_FixModeChanged(ByVal sender As Object, ByVal e As FixModeEventArgs) Handles GpsReceiver.FixModeChanged
  326.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Satellite fix mode has changed.")
  327.         ' Update the magnetic variation
  328.         Invoke(New EventHandler(AddressOf UpdateFixInformation))
  329.     End Sub
  330.  
  331.     Private Sub GPS_FixObtained(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.FixObtained
  332.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Satellite fix has been obtained!")
  333.         ' Update the magnetic variation
  334.         Invoke(New EventHandler(AddressOf UpdateFixInformation))
  335.     End Sub
  336.  
  337.     Private Sub GPS_FixQualityChanged(ByVal sender As Object, ByVal e As FixQualityEventArgs) Handles GpsReceiver.FixQualityChanged
  338.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "Satellite fix quality has changed")
  339.         ' Update the magnetic variation
  340.         Invoke(New EventHandler(AddressOf UpdateFixInformation))
  341.     End Sub
  342.  
  343. #End Region
  344.  
  345. #Region " Demonstration of Satellite-Related GPS Events "
  346.  
  347.     Private Sub UpdateSatelliteCounts(ByVal sender As Object, ByVal e As SatelliteCountEventArgs)
  348.         Select Case e.Type
  349.             Case SatelliteCountType.ActiveCount
  350.                 ActiveSatellites.Text = e.Count
  351.             Case SatelliteCountType.FixedCount
  352.                 FixedSatellites.Text = e.Count
  353.             Case SatelliteCountType.TrackedCount
  354.                 TrackedSatellites.Text = e.Count
  355.         End Select
  356.     End Sub
  357.  
  358.     Private Sub UpdateSatellite(ByVal sender As Object, ByVal e As SatelliteEventArgs)
  359.         With SatelliteList.Items(e.Satellite.Index)
  360.             .Text = e.Satellite.PseudoRandomCode
  361.             .SubItems(1).Text = e.Satellite.Elevation.ToString
  362.             .SubItems(2).Text = e.Satellite.Azimuth.ToString
  363.             .SubItems(3).Text = e.Satellite.SignalToNoiseRatio.ToString & " (" & e.Satellite.SignalToNoiseRatio.Rating.ToString & ")"
  364.             If e.Satellite.IsFixObtained Then
  365.                 .BackColor = Color.FromArgb(60, 0, 255, 0)
  366.             Else
  367.                 .BackColor = Color.FromArgb(60, 255, 0, 0)
  368.             End If
  369.         End With
  370.     End Sub
  371.  
  372.     Private Sub GPS_SatelliteAzimuthChanged(ByVal sender As Object, ByVal e As SatelliteEventArgs) Handles GpsReceiver.SatelliteAzimuthChanged
  373.         Invoke(New SatelliteEventHandler(AddressOf UpdateSatellite), sender, e)
  374.     End Sub
  375.  
  376.     Private Sub GPS_SatelliteElevationChanged(ByVal sender As Object, ByVal e As SatelliteEventArgs) Handles GpsReceiver.SatelliteElevationChanged
  377.         Invoke(New SatelliteEventHandler(AddressOf UpdateSatellite), sender, e)
  378.     End Sub
  379.  
  380.     Private Sub GPS_SatelliteFixLost(ByVal sender As Object, ByVal e As SatelliteEventArgs) Handles GpsReceiver.SatelliteFixLost
  381.         Invoke(New SatelliteEventHandler(AddressOf UpdateSatellite), sender, e)
  382.     End Sub
  383.  
  384.     Private Sub GPS_SatelliteFixObtained(ByVal sender As Object, ByVal e As SatelliteEventArgs) Handles GpsReceiver.SatelliteFixObtained
  385.         Invoke(New SatelliteEventHandler(AddressOf UpdateSatellite), sender, e)
  386.     End Sub
  387.  
  388.     Private Sub GPS_SatellitePRCChanged(ByVal sender As Object, ByVal e As SatelliteEventArgs) Handles GpsReceiver.SatellitePseudoRandomCodeChanged
  389.         Invoke(New SatelliteEventHandler(AddressOf UpdateSatellite), sender, e)
  390.     End Sub
  391.  
  392.     Private Sub GPS_SatelliteSignalToNoiseRatioChanged(ByVal sender As Object, ByVal e As SatelliteEventArgs) Handles GpsReceiver.SatelliteSignalToNoiseRatioChanged
  393.         Invoke(New SatelliteEventHandler(AddressOf UpdateSatellite), sender, e)
  394.     End Sub
  395.  
  396.     ' Handles three events: SatelliteActiveCountChanged, SatelliteFixCountChanged, SatelliteTrackedCountChanged
  397.     Private Sub GPS_SatelliteCountChanged(ByVal sender As Object, ByVal e As SatelliteCountEventArgs) Handles GpsReceiver.SatelliteFixedCountChanged, GpsReceiver.SatelliteActiveCountChanged, GpsReceiver.SatelliteTrackedCountChanged
  398.         Invoke(New SatelliteCountEventHandler(AddressOf UpdateSatelliteCounts), sender, e)
  399.     End Sub
  400. #End Region
  401.  
  402. #Region " Demonstration of Raw Sentence Processing "
  403.  
  404.     ' Stores information about the current sentence
  405.     Private CurrentSentence As String
  406.     ' Returns True if the sentence was fully understood
  407.     Private CurrentSentenceType As SentenceType
  408.  
  409.     ' Adds the specified sentence to the list
  410.     Private Sub AddSentence(ByVal sender As Object, ByVal e As EventArgs)
  411.         Select Case CurrentSentenceType
  412.             Case SentenceType.Recognized
  413.                 ' The sentence was processed successfully
  414.                 RecognizedSentences.Items.Add(CurrentSentence)
  415.                 RecognizedSentences.SelectedIndex = RecognizedSentences.Items.Count - 1
  416.                 ' Prevent too many lines from being in the list box
  417.                 If RecognizedSentences.Items.Count > 50 Then RecognizedSentences.Items.RemoveAt(0)
  418.             Case SentenceType.Unrecognized
  419.                 ' The sentence contained some corrupt data, or was proprietary to a specific device
  420.                 UnrecognizedSentences.Items.Add(CurrentSentence)
  421.                 UnrecognizedSentences.SelectedIndex = UnrecognizedSentences.Items.Count - 1
  422.                 ' Prevent too many lines from being in the list box
  423.                 If UnrecognizedSentences.Items.Count > 50 Then UnrecognizedSentences.Items.RemoveAt(0)
  424.         End Select
  425.     End Sub
  426.  
  427.     ' Handles two events: SentenceReceived and UnrecognizedSentenceReceived
  428.     Private Sub GPS_SentenceReceived(ByVal sender As Object, ByVal e As SentenceEventArgs) Handles GpsReceiver.SentenceReceived, GpsReceiver.UnrecognizedSentenceReceived
  429.         CurrentSentence = e.Sentence
  430.         CurrentSentenceType = e.Type
  431.         ' Now add the sentence
  432.         Invoke(New EventHandler(AddressOf AddSentence))
  433.     End Sub
  434.  
  435.     ' Raised when someone clicks on the "Parse" button.
  436.     Private Sub ParseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ParseButton.Click
  437.         ' Parse the data which was entered into the text box
  438.         Try
  439.             GpsReceiver.Parse(ParsingText.Text)
  440.         Catch ex As Exception
  441.             Stop
  442.         End Try
  443.     End Sub
  444. #End Region
  445.  
  446. #Region " Demonstration of GPS device date/time information "
  447.  
  448.     ' Updates the form with local date/time information
  449.     Public Sub UpdateLocalTime(ByVal sender As Object, ByVal e As EventArgs)
  450.         LocalTime.Text = Now.ToString
  451.     End Sub
  452.  
  453.     ' Updates the form with GPS device's date/time information
  454.     Public Sub UpdateGpsTime(ByVal sender As Object, ByVal e As DateTimeEventArgs)
  455.         ' NOTE: GPS devices send time in UTC.  We must convert it to local time
  456.         UTCDateTime.Text = e.DateTime.ToLocalTime.ToString
  457.     End Sub
  458.  
  459.     ' Update the local time to show the comparison between local time and the time obtained from the GPS receiver
  460.     Private Sub LocalTimeTimer_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles LocalTimeTimer.Elapsed
  461.         Invoke(New EventHandler(AddressOf UpdateLocalTime))
  462.     End Sub
  463.  
  464.     ' Raised whenever the GPS device reports a new date/time
  465.     ' NOTE: Several devices stop sending this information as soon as a fix is obtained!
  466.     Private Sub GPS_UTCDateTimeChanged(ByVal sender As Object, ByVal e As DateTimeEventArgs) Handles GpsReceiver.UtcDateTimeChanged
  467.         Me.Invoke(New StatusBarEventHandler(AddressOf UpdateStatusBar), "GPS date/time has changed.")
  468.         ' Update the magnetic variation
  469.         Invoke(New DateTimeEventHandler(AddressOf UpdateGpsTime), sender, e)
  470.     End Sub
  471. #End Region
  472.  
  473. #Region " Demonstration of Waypoints "
  474.  
  475.     Private CurrentWaypoint As Waypoint
  476.  
  477.     ' Raised when the "Refresh" button is clicked on the Waypoints tab
  478.     Private Sub DownloadWaypointButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DownloadWaypointButton.Click
  479.         ' Retrieve the latest waypoints from the device (asynchronously)
  480.         Try
  481.             GpsReceiver.Waypoints.Refresh(True)
  482.         Catch ex As GpsException
  483.             MessageBox.Show(ex.ToString, "Unable to Load Waypoints", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
  484.         End Try
  485.     End Sub
  486.  
  487.     ' Raised when a new waypoint is selected
  488.     Private Sub WaypointList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WaypointList.SelectedIndexChanged
  489.         ' Enable the Edit button
  490.         EditWaypointButton.Enabled = True
  491.     End Sub
  492.  
  493.     ' Raised when the "New..." button is clicked on the Waypoints tab
  494.     Private Sub NewWaypointButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewWaypointButton.Click
  495.         ' Make a new waypoint form
  496.         Dim WaypointForm As New NewWaypointForm
  497.         ' Tell the form what kind of GPS device we're using
  498.         WaypointForm.Device = GpsReceiver.Device
  499.         ' Show the form
  500.         WaypointForm.Show()
  501.     End Sub
  502.  
  503.     ' Raised when the "Edit..." button is clicked on the Waypoints tab
  504.     Private Sub EditWaypointButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditWaypointButton.Click
  505.         ' Get the waypoint that was clicked 
  506.         Dim SelectedWaypoint As Waypoint = GpsReceiver.Waypoints(WaypointList.SelectedItems(0).Text)
  507.         ' Make a new editor form
  508.         Dim EditForm As New EditWaypointForm
  509.         ' Tell this form to edit the selected waypoint
  510.         EditForm.Waypoint = SelectedWaypoint
  511.         ' Show the form
  512.         EditForm.Show()
  513.     End Sub
  514.  
  515.     ' Raised when a waypoint is double-clicked
  516.     Private Sub WaypointList_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles WaypointList.DoubleClick
  517.         ' Is anything selected?
  518.         If WaypointList.SelectedItems.Count = 0 Then Exit Sub
  519.         ' Open the selected item
  520.         EditWaypointButton_Click(sender, e)
  521.     End Sub
  522.  
  523.     Private Sub UpdateCrossTrackError(ByVal sender As Object, ByVal e As CrossTrackErrorEventArgs)
  524.         ' Update the cross-track error
  525.         Me.CrossTrackError.Text = e.CrossTrackError.ToString
  526.         ' Update the recommended steering direction to correct the error
  527.         Me.RecommendedSteeringDirection.Text = e.CrossTrackError.RecommendedSteeringDirection.ToString
  528.     End Sub
  529.  
  530.     Private Sub UpdateOriginWaypoint(ByVal sender As Object, ByVal e As WaypointEventArgs)
  531.         Me.OriginWaypoint.Text = e.Waypoint.ToString
  532.     End Sub
  533.  
  534.     Private Sub UpdateDestinationWaypoint(ByVal sender As Object, ByVal e As WaypointEventArgs)
  535.         Me.DestinationWaypoint.Text = e.Waypoint.ToString
  536.     End Sub
  537.  
  538.     Private Sub UpdateClearWaypointList(ByVal sender As Object, ByVal e As EventArgs)
  539.         DownloadWaypointButton.Enabled = False
  540.         WaypointList.Items.Clear()
  541.     End Sub
  542.  
  543.     Private Sub UpdateCompleteWaypointList(ByVal sender As Object, ByVal e As EventArgs)
  544.         DownloadWaypointButton.Enabled = True
  545.     End Sub
  546.  
  547.     ' Adds the specified sentence to the list
  548.     Private Sub AddWaypoint(ByVal sender As Object, ByVal e As EventArgs)
  549.         Dim WaypointListItem As ListViewItem
  550.         ' Does this waypoint already exist in the list view?
  551.         If WaypointItemExists(CurrentWaypoint.Name) Then
  552.             ' Yes. Update the existing list view item
  553.             WaypointListItem = GetWaypointItem(CurrentWaypoint.Name)
  554.             WaypointListItem.SubItems(0).Text = CurrentWaypoint.Latitude.ToString
  555.             WaypointListItem.SubItems(1).Text = CurrentWaypoint.Longitude.ToString
  556.             WaypointListItem.SubItems(2).Text = CurrentWaypoint.Symbol.ToString
  557.             WaypointListItem.SubItems(3).Text = CurrentWaypoint.Description
  558.         Else
  559.             ' No. Make a new list view item
  560.             WaypointListItem = WaypointList.Items.Add(CurrentWaypoint.Name)
  561.             WaypointListItem.SubItems.Add(CurrentWaypoint.Latitude.ToString)
  562.             WaypointListItem.SubItems.Add(CurrentWaypoint.Longitude.ToString)
  563.             WaypointListItem.SubItems.Add(CurrentWaypoint.Symbol.ToString)
  564.             WaypointListItem.SubItems.Add(CurrentWaypoint.Description)
  565.         End If
  566.     End Sub
  567.  
  568.     ' Raised just before the collection of waypoints is re-downloaded
  569.     Private Sub GPS_WaypointDownloadBegins(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.WaypointDownloadBegins
  570.         Invoke(New EventHandler(AddressOf UpdateClearWaypointList))
  571.     End Sub
  572.  
  573.     ' Returns True if the waypoint name currently exists in the WaypointList list view
  574.     Private Function WaypointItemExists(ByVal name As String) As Boolean
  575.         Dim WaypointListViewItem As ListViewItem
  576.         For Each WaypointListViewItem In WaypointList.Items
  577.             If WaypointListViewItem.Text = name Then Return True
  578.         Next
  579.     End Function
  580.  
  581.     ' Returns the waypoint list item associated with the specified waypoint name
  582.     Private Function GetWaypointItem(ByVal name As String) As ListViewItem
  583.         Dim WaypointListViewItem As ListViewItem
  584.         For Each WaypointListViewItem In WaypointList.Items
  585.             If WaypointListViewItem.Text = name Then Return WaypointListViewItem
  586.         Next
  587.         Return Nothing
  588.     End Function
  589.  
  590.     ' Raised when one waypoint has been downloaded from the GPS device
  591.     Private Sub GPS_WaypointDownloaded(ByVal sender As Object, ByVal e As StormSource.Gps.WaypointEventArgs) Handles GpsReceiver.WaypointDownloaded
  592.         ' Set the current waypoint
  593.         CurrentWaypoint = e.Waypoint
  594.         ' And add it to the List View
  595.         Invoke(New EventHandler(AddressOf AddWaypoint))
  596.     End Sub
  597.  
  598.     ' Raised when the last waypoint has been downloaded from the device
  599.     Private Sub GPS_WaypointDownloadEnds(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.WaypointDownloadEnds
  600.         ' Re-enable the Refresh button
  601.         Invoke(New EventHandler(AddressOf UpdateCompleteWaypointList))
  602.     End Sub
  603.  
  604.  
  605.     Private Sub GPS_DestinationWaypointArrivalAlarm(ByVal sender As Object, ByVal e As StormSource.Gps.WaypointEventArgs) Handles GpsReceiver.DestinationWaypointArrivalAlarm
  606.         Stop
  607.     End Sub
  608.  
  609.     Private Sub GPS_DestinationWaypointChanged(ByVal sender As Object, ByVal e As StormSource.Gps.WaypointEventArgs) Handles GpsReceiver.DestinationWaypointChanged
  610.         ' Update the destination waypoint
  611.         Me.Invoke(New WaypointEventHandler(AddressOf UpdateDestinationWaypoint))
  612.     End Sub
  613.  
  614.     Private Sub GPS_OriginWaypointChanged(ByVal sender As Object, ByVal e As StormSource.Gps.WaypointEventArgs) Handles GpsReceiver.OriginWaypointChanged
  615.         ' Update the origin waypoint
  616.         Me.Invoke(New WaypointEventHandler(AddressOf UpdateOriginWaypoint))
  617.     End Sub
  618. #End Region
  619.  
  620. #Region " Demonstration of GPS Device Identification "
  621.  
  622.     ' Raised when GpsReceiver.NET is able to identify this device uniquely from any other device
  623.     Private Sub GPS_DeviceIdentified(ByVal sender As Object, ByVal e As StormSource.Gps.DeviceEventArgs) Handles GpsReceiver.DeviceIdentified
  624.         Invoke(New EventHandler(AddressOf UpdateDeviceInformation))
  625.     End Sub
  626.  
  627.     Private Sub GPS_ProtocolChanged(ByVal sender As Object, ByVal e As StormSource.Gps.DeviceEventArgs) Handles GpsReceiver.ProtocolChanged
  628.         Invoke(New EventHandler(AddressOf UpdateDeviceInformation))
  629.     End Sub
  630.  
  631.     Private Sub GPS_ManufacturerChanged(ByVal sender As Object, ByVal e As StormSource.Gps.DeviceEventArgs) Handles GpsReceiver.ManufacturerChanged
  632.         Invoke(New EventHandler(AddressOf UpdateDeviceInformation))
  633.     End Sub
  634.  
  635.     Private Sub GPS_ProductNameChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GpsReceiver.ProductNameChanged
  636.         Invoke(New EventHandler(AddressOf UpdateDeviceInformation))
  637.     End Sub
  638.  
  639.     Private Sub GPS_BatteryLifeChanged(ByVal sender As Object, ByVal e As StormSource.Gps.TimeSpanEventArgs) Handles GpsReceiver.BatteryLifeChanged
  640.         Invoke(New EventHandler(AddressOf UpdateDeviceInformation))
  641.     End Sub
  642.  
  643.     ' Updates the form on the form's thread
  644.     Private Sub UpdateDeviceInformation(ByVal sender As Object, ByVal e As EventArgs)
  645.         Try
  646.             ' Update device indentification information
  647.             Me.Manufacturer.Text = GpsReceiver.Device.Manufacturer.ToString
  648.             Me.DeviceName.Text = GpsReceiver.Device.Name
  649.             Me.SoftwareVersion.Text = GpsReceiver.Device.SoftwareVersion
  650.             Me.Protocol.Text = GpsReceiver.Device.Protocol.ToString
  651.             Me.BatteryLife.Text = GpsReceiver.Device.BatteryLife.ToString
  652.             ' Update waypoint capabilities
  653.             Me.WaypointAddressCheckbox.Checked = GpsReceiver.Device.SupportsWaypointAddress
  654.             Me.WaypointAltitudeCheckbox.Checked = GpsReceiver.Device.SupportsWaypointAltitude
  655.             Me.WaypointCityCheckbox.Checked = GpsReceiver.Device.SupportsWaypointCity
  656.             Me.WaypointColorCheckbox.Checked = GpsReceiver.Device.SupportsWaypointColor
  657.             Me.WaypointCommentCheckbox.Checked = GpsReceiver.Device.SupportsWaypointComment
  658.             Me.WaypointCountryCheckbox.Checked = GpsReceiver.Device.SupportsWaypointCountry
  659.             Me.WaypointIntersectingRoadCheckbox.Checked = GpsReceiver.Device.SupportsWaypointIntersectingRoad
  660.             Me.WaypointDepthCheckbox.Checked = GpsReceiver.Device.SupportsWaypointDepth
  661.             Me.WaypointDisplayModeCheckbox.Checked = GpsReceiver.Device.SupportsWaypointDisplayMode
  662.             Me.WaypointFacilityNameCheckbox.Checked = GpsReceiver.Device.SupportsWaypointFacility
  663.             Me.WaypointStateCheckbox.Checked = GpsReceiver.Device.SupportsWaypointState
  664.             Me.WaypointSymbolCheckbox.Checked = GpsReceiver.Device.SupportsWaypointSymbol
  665.  
  666.             ' To make features stand out more, enable/disable the checkbox
  667.             Me.WaypointAddressCheckbox.Enabled = Me.WaypointAddressCheckbox.Checked
  668.             Me.WaypointAltitudeCheckbox.Enabled = Me.WaypointAltitudeCheckbox.Checked
  669.             Me.WaypointCityCheckbox.Enabled = Me.WaypointCityCheckbox.Checked
  670.             Me.WaypointColorCheckbox.Enabled = Me.WaypointColorCheckbox.Checked
  671.             Me.WaypointColorComboBox.Enabled = Me.WaypointColorCheckbox.Checked
  672.             Me.WaypointCommentCheckbox.Enabled = Me.WaypointCommentCheckbox.Checked
  673.             Me.WaypointCountryCheckbox.Enabled = Me.WaypointCountryCheckbox.Checked
  674.             Me.WaypointIntersectingRoadCheckbox.Enabled = Me.WaypointIntersectingRoadCheckbox.Checked
  675.             Me.WaypointDepthCheckbox.Enabled = Me.WaypointDepthCheckbox.Checked
  676.             Me.WaypointDisplayModeCheckbox.Enabled = Me.WaypointDisplayModeCheckbox.Checked
  677.             Me.WaypointDisplayModeComboBox.Enabled = Me.WaypointDisplayModeCheckbox.Checked
  678.             Me.WaypointFacilityNameCheckbox.Enabled = Me.WaypointFacilityNameCheckbox.Checked
  679.             Me.WaypointStateCheckbox.Enabled = Me.WaypointStateCheckbox.Checked
  680.             Me.WaypointSymbolCheckbox.Enabled = Me.WaypointSymbolCheckbox.Checked
  681.             Me.WaypointSymbolComboBox.Enabled = Me.WaypointSymbolCheckbox.Checked
  682.             ' Update available waypoint symbols
  683.             WaypointSymbolComboBox.Items.Clear()
  684.             WaypointSymbolComboBox.Items.AddRange(GpsReceiver.Device.GetSymbols)
  685.             WaypointSymbolComboBox.SelectedIndex = 0
  686.             ' Update available waypoint colors
  687.             WaypointColorComboBox.Items.Clear()
  688.             WaypointColorComboBox.Items.AddRange(GpsReceiver.Device.GetColors)
  689.             WaypointColorComboBox.SelectedIndex = 0
  690.             ' Update available waypoint display modes
  691.             WaypointDisplayModeComboBox.Items.Clear()
  692.             WaypointDisplayModeComboBox.Items.AddRange(GpsReceiver.Device.GetDisplayModes)
  693.             WaypointDisplayModeComboBox.SelectedIndex = 0
  694.             ' Enable/disable features based on the protocol
  695.             Me.PowerOffButton.Enabled = (GpsReceiver.Device.Protocol = StormSource.Gps.Protocol.GarminBinary)
  696.             Me.NewWaypointButton.Enabled = (GpsReceiver.Device.Protocol = StormSource.Gps.Protocol.GarminBinary)
  697.             Me.DownloadWaypointButton.Enabled = (GpsReceiver.Device.Protocol = StormSource.Gps.Protocol.GarminBinary)
  698.         Catch ex As Exception
  699.         End Try
  700.     End Sub
  701.  
  702. #End Region
  703.  
  704. #Region " Demonstration of powering off a GPS device "
  705.     ' NOTE: Currently, the PowerOff() method is only supported when using the Garmin┬« 
  706.     '       binary protocol. Set your device to use the Garmin protocol before using this method.
  707.     Private Sub PowerOffButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PowerOffButton.Click
  708.         ' Confirm that the device should be powered off
  709.         Select Case MessageBox.Show("When you turn off the GPS device, you will need to turn it back on manually.  Do you still want to power off the device?", "GPS Device Power-Off", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
  710.             Case DialogResult.Yes
  711.                 Try
  712.                     ' Try to power off the device.  If the device is not using the Garmin┬« protocol, this will fail
  713.                     GpsReceiver.Device.PowerOff()
  714.                 Catch ex As GpsException
  715.                     ' The power-off failed
  716.                     MessageBox.Show("The device must be set to the Garmin┬« protocol in order for it to be shut off.  Please change the protocol and try again.", "Unable to Power Off", MessageBoxButtons.OK, MessageBoxIcon.Warning)
  717.                 End Try
  718.         End Select
  719.     End Sub
  720. #End Region
  721.  
  722. #Region " Demonstration of Viewer Rotation "
  723.  
  724.     Private RotateThread As System.Threading.Thread
  725.  
  726.     Private Sub UpdateRotation()
  727.         Do While True
  728.             ' Increase the rotation angle by half a degree
  729.             SatelliteViewer.Bearing += 0.4
  730.             ' Sleep for 50ms
  731.             System.Threading.Thread.Sleep(30)
  732.         Loop
  733.     End Sub
  734.  
  735.     Private Sub chkEnableRotation_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkEnableRotation.CheckedChanged
  736.         If chkEnableRotation.Checked Then
  737.             ' Enable the rotation
  738.             RotateThread = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf UpdateRotation))
  739.             RotateThread.Name = "Demo of Rotating Satellite Viewer"
  740.             RotateThread.IsBackground = True
  741.             RotateThread.Start()
  742.         Else
  743.             ' Disable the rotation
  744.             If Not RotateThread Is Nothing Then
  745.                 RotateThread.Abort()
  746.                 RotateThread = Nothing
  747.             End If
  748.             ' Reset the rotation to zero
  749.             SatelliteViewer.Bearing = 0
  750.         End If
  751.     End Sub
  752.  
  753. #End Region
  754.  
  755. #Region " Demonstration of Viewer Customization "
  756.  
  757.     Private Sub chkShowPRCNumbers_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkShowPRCNumbers.CheckedChanged
  758.         SatelliteViewer.IsSatellitePrcVisible = chkShowPRCNumbers.Checked
  759.     End Sub
  760.  
  761.     Private Sub ShowCompassCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowCompassCheckBox.CheckedChanged
  762.         SatelliteViewer.IsCompassVisible = ShowCompassCheckBox.Checked
  763.     End Sub
  764. #End Region
  765.  
  766. #Region " Miscellaneous Form Events "
  767.  
  768.     Public Delegate Sub StatusBarEventHandler(ByVal message As String)
  769.  
  770.     ' Used to update the status bar
  771.     Public Sub UpdateStatusBar(ByVal message As String)
  772.         StatusBar.Text = message
  773.     End Sub
  774.  
  775.     Private Sub MainForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  776.         ' Stop GPS services
  777.         GpsReceiver.Stop()
  778.         ' Clean up by disposing of resources
  779.         LocalTimeTimer.Dispose()
  780.         GpsReceiver.Dispose()
  781.     End Sub
  782.  
  783.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  784.         ' Bind the SatelliteViewer to our GPS receiver
  785.         SatelliteViewer.Receiver = GpsReceiver
  786.         ' Start updating the local time
  787.         LocalTimeTimer.Enabled = True
  788.     End Sub
  789. #End Region
  790.  
  791. End Class